package jangdolbaeng2.seller.action;

import java.util.List;
import java.util.Map;

import org.apache.struts2.dispatcher.SessionMap;
import org.apache.struts2.interceptor.SessionAware;

import jangdolbaeng2.seller.dao.BoardDAO;
import jangdolbaeng2.seller.dao.spamDAO;
import jangdolbaeng2.vo.Shop_qaVO;
import jangdolbaeng2.vo.spamVO;

import com.opensymphony.xwork2.ActionSupport;

public class SpamAction extends ActionSupport implements SessionAware {
	
	private SessionMap<String, Object> sessionMap; // session
	
	private int spam_seq;
	private int shop_seq;
	private String keywords;
	private List<spamVO> spamlist;
	private spamVO vo;
	private Shop_qaVO qaVO; 
	
	
	public String Spamlist() throws Exception{
		//스팸 목록 보기	
		spamDAO dao = new spamDAO();
		
		shop_seq = (int)sessionMap.get("shop_seq");
		
		spamVO vo = new spamVO(spam_seq, shop_seq, keywords);
		spamlist = dao.spamlist(vo);
		return SUCCESS;
	}

	public String inputspam() throws Exception{
		//스팸 등록하기
		spamDAO dao = new spamDAO();
		
		shop_seq = (int)sessionMap.get("shop_seq");
		
		spamVO vo = new spamVO(spam_seq, shop_seq, keywords);
		dao.inputspam(vo);
		
		return SUCCESS;
	}
	
	public String del_spamlist() throws Exception{
		//스팸 지정단어 삭제
		spamDAO dao = new spamDAO();
		BoardDAO boardDao = new BoardDAO();
		shop_seq = (int)sessionMap.get("shop_seq");
		
		spamVO vo = new spamVO(spam_seq, shop_seq, keywords);
		
		dao.del_spamlist(vo);
		
		return SUCCESS;
	}
	
	public String spamlist() throws Exception{
		//qa글 입력 전 스팸 필터
		
		return SUCCESS;
	}
	
	
	public Shop_qaVO getQaVO() {
		return qaVO;
	}

	public void setQaVO(Shop_qaVO qaVO) {
		this.qaVO = qaVO;
	}

	public int getShop_seq() {
		return shop_seq;
	}

	public void setShop_seq(int shop_seq) {
		this.shop_seq = shop_seq;
	}

	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}
	
	public int getSpam_seq() {
		return spam_seq;
	}

	public void setSpam_seq(int spam_seq) {
		this.spam_seq = spam_seq;
	}

	public List<spamVO> getSpamlist() {
		return spamlist;
	}

	public void setSpamlist(List<spamVO> spamlist) {
		this.spamlist = spamlist;
	}

	public spamVO getVo() {
		return vo;
	}

	public void setVo(spamVO vo) {
		this.vo = vo;
	}

	@Override
	public void setSession(Map<String, Object> arg0) {
		 sessionMap =(SessionMap<String, Object>) arg0;	
	}
	
	
}
